import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import { concat } from "lodash-es";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "申请人",
      prop: "user_id",
      render: "input",
      renderProps: {
        placeholder: "请输入申请人ID",
      },
      itemProps: { rules: [{ required: true, message: "请输入申请人" }] },
    },
    {
      label: "申请范围",
      prop: "area",
      render: "select",
      renderProps: {
        placeholder: "请选择申请范围",
        options: [
          { label: "项目", value: 1 },
          { label: "工区", value: 2 },
          { label: "站点", value: 3 },
        ],
      },
      itemProps: {
        rules: [{ required: true, message: "请选择申请范围" }],
      },
    },
    {
      label: "申请范围ID",
      prop: "area_ids",
      render: "select",
      renderProps: {
        placeholder: "请选择申请范围ID",
        multiple: true,
        clearable: true,
        filterable: true,
        options: [],
      },
      itemProps: { rules: [{ required: true, message: "请选择申请范围ID" }] },
    },
    {
      label: "审批人",
      prop: "apply_id",
      render: "input",
      renderProps: {
        placeholder: "请输入审批人ID",
      },
      itemProps: { rules: [{ required: true, message: "请输入审批人" }] },
    },
    {
      label: "审批状态",
      prop: "status",
      render: "select",
      renderProps: {
        placeholder: "请选择审批状态",
        options: [
          { label: "待审批", value: 1 },
          { label: "通过", value: 2 },
          { label: "拒绝", value: 3 },
        ],
      },
      itemProps: {
        rules: [{ required: true, message: "请选择审批状态" }],
      },
    },
  ]);
}
